package logic

import (
	"context"
	user "shortvideo2zk/common/proto"
	"shortvideo2zk/service/server"
)

type ServerUser struct {
	user.UnimplementedUserServer
}

func (s ServerUser) SendSms(ctx context.Context, in *user.SendSmsReq) (*user.SendSmsResp, error) {
	sms, err := server.SendSms(in)
	if err != nil {
		return nil, err
	}
	return sms, nil
}

func (s ServerUser) UserRegister(ctx context.Context, in *user.UserRegisterReq) (*user.UserRegisterResp, error) {
	register, err := server.UserRegister(in)
	if err != nil {
		return nil, err
	}
	return register, nil
}

func (s ServerUser) UserLogin(ctx context.Context, in *user.UserLoginReq) (*user.UserLoginResp, error) {
	login, err := server.UserLogin(in)
	if err != nil {
		return nil, err
	}
	return login, nil
}

func (s ServerUser) VideoList(ctx context.Context, in *user.VideoListReq) (*user.VideoListResp, error) {
	list, err := server.VideoList(in)
	if err != nil {
		return nil, err
	}
	return list, nil
}
func (s ServerUser) AddVideo(ctx context.Context, in *user.AddVideoReq) (*user.AddVideoResp, error) {
	video, err := server.AddVideo(in)
	if err != nil {
		return nil, err
	}
	return video, nil
}
func (s ServerUser) FindVideo(ctx context.Context, in *user.FindVideoReq) (*user.VideoListResp, error) {
	video, err := server.FindVideo(in)
	if err != nil {
		return nil, err
	}
	return video, nil
}
func (s ServerUser) UpdateVideoStatus(ctx context.Context, in *user.UpdateVideoStatusReq) (*user.UpdateVideoStatusResp, error) {
	video, err := server.UpdateVideoStatus(in)
	if err != nil {
		return nil, err
	}
	return video, nil
}

func (s ServerUser) VideoSort(ctx context.Context, in *user.VideoSortReq) (*user.VideoListResp, error) {
	video, err := server.VideoSort(in)
	if err != nil {
		return nil, err
	}
	return video, nil
}

func (s ServerUser) DelVideo(ctx context.Context, in *user.DelVideoReq) (*user.DelVideoResp, error) {
	video, err := server.DelVideo(in)
	if err != nil {
		return nil, err
	}
	return video, nil
}
